package com.bicycle.rentalsystem.servelt.admin;


import com.bicycle.rentalsystem.pojo.admin.Page;
import com.bicycle.rentalsystem.pojo.admin.Recharge;
import com.bicycle.rentalsystem.service.user.RechargeService;
import com.bicycle.rentalsystem.service.impl.admin.RechargeServiceImpl;
import com.bicycle.rentalsystem.utils.WebUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@WebServlet("/rechargeServlet")
public class RechargeServlet extends BaseServlet {

    private RechargeService rechargeService = new RechargeServiceImpl();

    protected void page(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取请求参数
        String pageNo = req.getParameter("pageNo");
        /*if(pageNo==null||pageNo==""){
            pageNo="1";
        }
        Integer pageNo2= Integer.valueOf(pageNo);*/
        int pageNo2 = WebUtil.parseInt(pageNo, 1);
        int pageSize = WebUtil.parseInt(req.getParameter("pageSize"), 4);
        //获取page对象
        Page<Recharge> page = rechargeService.page(pageNo2, 4);
        //保存到request域中
        req.setAttribute("page",page);
        //请求转发
        req.getRequestDispatcher("admin/a5.jsp").forward(req,resp);
    }
}
